package fr.labri.macchiato.framework.business.service;

import fr.labri.macchiato.framework.business.finder.BusinessEntityFinder;
import fr.labri.macchiato.framework.business.finder.ProductFinder;
import fr.labri.macchiato.framework.business.repository.PreferencesRepository;
import fr.labri.macchiato.framework.business.repository.ProjectRepository;

/**
 * 
 * Factory for the persisted services, which persists entities into the cache so we can collect and restore them after close
 * 
 * @author Michelle AVOMO
 * 
 */

public class PersistedServiceFactory implements ServiceFactory {

	@Override
	public PreferencesService newPreferencesService() {

		return new PreferencesService(new PreferencesRepository(true));
	}

	@Override
	public ProjectService newProjectService(ProductFinder finder) {

		return new ProjectService(new ProjectRepository(true),
				newPreferencesService(), finder);
	}

	@Override
	public BusinessEntityService newBusinessEntityService(
			BusinessEntityFinder finder) {
		return new BusinessEntityService(finder);
	}

}
